<template>
  <div class="courses courses3" @click="goDetail(Number(id))">
    <div class="course shadow">
      <div class="iconPathBox">
        <img :src="img" lazy="loaded">
      </div>
      <div class="name">{{ name }}</div>
      <div class="desc"> 简介：{{ desc }}</div>
      <div class="time"> 上课时间：{{date1 }} ~ {{ date2 }}</div>
    </div>
  </div>
</template>

<script setup>
  const goDetail = (id) => {
    router.push({ path: '/front/task', query: { corId: id } })
  }
  import { useRoute, useRouter } from "vue-router";

  let route = useRoute()
  let router = useRouter()
  const props = defineProps(['name', 'desc', 'time1', 'time2', 'img', 'id'])
  const time1 = new Date(props.time1);

  // 提取日期部分
  const date1 = time1.toISOString().split("T")[0];
  const time2 = new Date(props.time2);

  // 提取日期部分
  const date2 = time2.toISOString().split("T")[0];


</script>

<style>
  .demo-tabs {
    margin-top: 20px;
    margin-left: 70px;

  }

  .Projectbox {
    position: relative;
    min-width: 900px;
    margin-bottom: 43px;
    height: 1000px;
    width: 1320px;
    left: 50%;
    transform: translate(-50%);
  }

  div {
    box-sizing: border-box;
    display: block;
    unicode-bidi: isolate;
  }

  .collapse {
    border-top: 1px solid #EBEEF5;
    border-bottom: 1px solid #EBEEF5;
    border: none;
    background-color: #fff;
    box-shadow: 0 10px 6px 0 rgba(19, 18, 18, .16);
    border-radius: 20px;
    border: 1px solid hsla(0, 0%, 85.1%, .5);
    overflow: hidden;

  }

  .active:last-child {
    margin-bottom: -1px;

  }

  .collapse .active .header {
    height: 80px;
  }

  .header,
  .wrap {
    padding: 0 10px;
    border: none;
  }

  @media only screen and (max-width: 700px) {
    .header {
      display: flex;
    }
  }


  .arrow {
    display: none;
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
    margin: 0 8px 0 auto;
    transition: -webkit-transform .3s;
    transition: transform .3s;
    transition: transform .3s, -webkit-transform .3s;
    font-weight: 300;
  }

  .header,
  .wrap {
    padding: 0 1px;
    border: none;
  }

  .wrap {
    will-change: height;
    background-color: #FFF;
    overflow: hidden;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    border-bottom: 1px solid #EBEEF5;
    margin-top: 30px;
  }

  .content {
    padding-bottom: 25px;
    font-size: 13px;
    color: #303133;
    line-height: 2;
  }

  .courses {
    margin-right: 00px;
    display: flex;
    align-items: center;
    flex-flow: row wrap;
  }

  @media only screen and (max-width: 603px) {
    .courses {
      justify-content: center !important;
    }
  }

  .course {
    cursor: pointer;
    padding: 4px 10px 0;
    margin-bottom: 15px;
    margin-left: 30px;
    margin-right: 30px;
    width: 240px;
    height: 270px;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #fff;
  }

  .shadow {
    box-shadow: 0 1px 5px 0 rgba(0, 0, 0, .16);
    transition: box-shadow .2s linear;
  }

  .desc,
  .name {
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .name {
    margin-top: 8px;
    font-family: Segoe UI;
    font-size: 18px;
    color: #707070;
  }

  .time {
    font-family: Segoe UI;
    font-size: 14px;
  }

  .iconPathBox img {
    -o-object-fit: cover;
    object-fit: cover;
    width: 220px;
    height: 135px;
    border-radius: 8px;
  }

  .iconBox img {
    margin-left: 80px;
    margin-top: 20px;
  }

  img {
    vertical-align: middle;
    border-style: none;
    width: 70px;

  }

  .iconBox {
    background: url(../../assets/logos.png);
    margin-left: 80px;
    margin-top: 20px;
    background-size: cover;
    height: 50px;
    width: 50px;
  }
</style>